package com.cipe.cmrs.controllers.reports;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.cipe.cmrs.model.Cipeproject;
import com.cipe.cmrs.model.User;
import com.cipe.cmrs.service.CipeprojectstatusService;
import com.cipe.cmrs.service.DonorService;
import com.cipe.cmrs.service.DonorawardService;
import com.cipe.cmrs.service.DonorawardstatusService;
import com.cipe.cmrs.service.RegionService;
import com.cipe.cmrs.service.UserService;

@Controller
@RequestMapping("/secure/showCipeProjectsIndCountriesForm.do")
public class CipeProjectsIncludeRandGReportController {
	@Autowired
	private RegionService regionService;
	@Autowired
	private CipeprojectstatusService cipeprojectstatusService;
	@Autowired
	private DonorawardService donorawardService;
	
	@Autowired
	private DonorawardstatusService	donorawardstatusService;
	@Autowired
	private DonorService donorService;
	protected static final String COMMAND_NAME = "cipeproject";
	private static final String FORM_VIEW = "reportForms/cipeProjectsIndCountriesForm";
	
	@RequestMapping(method = RequestMethod.GET)
    protected ModelAndView getFormView(@ModelAttribute(COMMAND_NAME) Cipeproject command, HttpServletRequest request) {
		
		   ModelAndView model=new ModelAndView(FORM_VIEW);
		   model.addObject("regionList", regionService.findAllOrderBy("displayName"));
		   model.addObject("cipeprojectstatusList", cipeprojectstatusService.findAllOrderBy("displayName"));		
		   model.addObject("donorawardList", donorawardService.getActiveDonoraward());
		   model.addObject("donorList", donorService.getAllDonors());
		   model.addObject("donorawardstatusList", donorawardstatusService.findAll());
		   return model.addAllObjects(getReferenceData(command, request));
    }
	
	protected Map<String, Object> getReferenceData(Cipeproject command, HttpServletRequest request) {
		Map<String, Object> map = new HashMap<String, Object>();
		return new HashMap<String, Object>();
    }

}
